<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns:jsp="http://java.sun.com/JSP/Page"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jstl/core"
  xmlns:ch="http://sourceforge.net/projects/jsf-comp"
  xmlns:fn="http://java.sun.com/jsp/jstl/functions"	
  xmlns:t="http://myfaces.apache.org/tomahawk"
  xmlns:p="http://primefaces.org/ui">
		  
	<ui:composition template="/template/pPrincipal.xhtml">	 		 
	  <ui:define name="head">
	    <title>BP - Verificacion de Consultas</title>
	  </ui:define>
	 
	 <ui:define name="titulopagina">
	  	 	Verificacion de Consultas
	  </ui:define>
	 
	  <ui:define name="bodyarea">
	 	   <f:event type="preRenderView" listener="#{verificacionConsultaController.onPageLoad}"/>
	 	   <p:messages id="messages" closable="true" />
	  	   <h:panelGrid headerClass="cabeceraPanelSimple" cellspacing="0" width="100%"
				cellpadding="5" styleClass="bordePanel" columns="1"  style="margin-bottom:5px">
				<f:facet name="header">
					<h:outputText value="Criterio de Consulta" />
				</f:facet>
		        <h:panelGrid columns="1">
		        	<h:panelGrid columns="4">
		        		<h:outputText value="Tipo:" styleClass="texto"/>		        		
						<p:selectOneMenu value="#{verificacionConsultaController.tipoConsulta}" id="idSelectTipoConsulta">
							<f:selectItem itemLabel="Consulta" itemValue="0"/>
							<f:selectItem itemLabel="Insert - Update - Delete" itemValue="1"/>
						</p:selectOneMenu>
						<p:spacer width="40" height="10"/>
						<p:commandButton icon="ui-icon-gear" actionListener="#{verificacionConsultaController.ejecutarConsulta}" 
							update=":formPrincipal:idPanelDataBean,:formPrincipal:messages" value="Ejecutar"
							process="@this,idSelectTipoConsulta,idCajaConsulta" />						
					</h:panelGrid>
					<p:inputTextarea value="#{verificacionConsultaController.consulta}" cols="110" rows="12" id="idCajaConsulta"/>
				</h:panelGrid>		
	       </h:panelGrid>
	        <h:panelGrid headerClass="cabeceraPanelSimple" cellspacing="0" width="100%"
				cellpadding="5" styleClass="bordePanel" columns="1"  style="margin-bottom:5px">
				<f:facet name="header">
					<h:outputText value="Resultados" />
				</f:facet>
				<t:div style="overflow-x: scroll; overflow-y: hidden; width: 960px;">
					<h:panelGrid columns="1" id="idPanelDataBean">
						<p:dataTable id="tablaResultados" value="#{verificacionConsultaController.listaDetalle}" var="fila"
							emptyMessage="No hay resultados." paginator="true" rows="10" rowIndexVar="rowIndex"
							styleClass="styleDataTableWrapNormal"
							rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'styleDataTableRowColorClaro' : 'styleDataTableRowColorOscuro'}">														
							<p:columns value="#{verificacionConsultaController.listaCabecera}" var="columna" columnIndexVar="colIndex">
					            <f:facet name="header">
					                <h:outputText value="#{columna}" />
					            </f:facet>
					            <h:outputText value="#{fila[colIndex]}" rendered="#{fila[colIndex] != null}"/>
					            <h:outputText value="" rendered="#{fila[colIndex] == null}"/>
					        </p:columns>
						</p:dataTable>
					</h:panelGrid>
				</t:div>
	       </h:panelGrid>
	  </ui:define>	 
	</ui:composition>
</html>